﻿<Window x:Class="ResourceBlender_Express.WinMain"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:ResourceBlender_Express"
    xmlns:converters="clr-namespace:ResourceBlender_Express.Converters"
    Title="ResourceBlender Total" Visibility="Collapsed" WindowStartupLocation="CenterScreen"
    Height="500" Width="600"
    MinHeight="300" MinWidth="400"
    Loaded="Window_Loaded"
    Style="{StaticResource {x:Type Window}}" Icon="/ResourceBlender-Express;component/images/resourceblender.ico">
    <Window.Resources>
        <converters:LanguageCodeListStringifier x:Key="LanguageCodeListStringifier" />
        <converters:BundleNameStringifier x:Key="BundleNameStringifier" />
        <DataTemplate x:Key="SummaryApplication" DataType="{x:Type loc:RBApplication}">
            <Border x:Name="PART_Border"
                    BorderThickness="1" CornerRadius="1">
            <Grid Margin="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                
                <TextBlock Grid.Row="0" IsHitTestVisible="True" Grid.Column="0" Grid.ColumnSpan="2" FontWeight="Bold" Text="{Binding DisplayName}" Style="{StaticResource HeadingFont}" Margin="0,0,0,5" />
                <TextBlock Grid.Row="1" IsHitTestVisible="True" Grid.Column="0" Margin="0,0,5,0" FontWeight="Bold" Text="Bundles" Style="{StaticResource PaddedTextBlock}" />
                <TextBlock Grid.Row="1" IsHitTestVisible="True" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Bundles,Converter={StaticResource BundleNameStringifier}}" Style="{StaticResource PaddedTextBlock}" />
                <TextBlock Grid.Row="2" IsHitTestVisible="True" Grid.Column="0" Margin="0,0,5,0" FontWeight="Bold" Text="Languages" Style="{StaticResource PaddedTextBlock}" />
                <TextBlock Grid.Row="2" IsHitTestVisible="True" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Languages,Converter={StaticResource LanguageCodeListStringifier}}" Style="{StaticResource PaddedTextBlock}" />
                <WrapPanel Grid.Row="3" IsHitTestVisible="True" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,1,5,5">
                    <Button Command="{x:Static loc:ResourceBlenderCommands.EditDefaultLanguage}" CommandParameter="{Binding}">Edit Default Language</Button>
                    <Button Command="{x:Static loc:ResourceBlenderCommands.EditAllLanguages}" CommandParameter="{Binding}">Edit All Languages</Button>
                </WrapPanel>
            </Grid>
            </Border>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" Value="True">
                    <Setter TargetName="PART_Border" Property="Background" Value="{StaticResource SelectedTransparentBackgroundBrush}" />
                    <Setter TargetName="PART_Border" Property="BorderBrush" Value="{StaticResource LightBorderBrush}" />
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </Window.Resources>
    
    <DockPanel LastChildFill="True">
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File">
                <MenuItem Header="_Options" Command="loc:ResourceBlenderCommands.ShowOptions" InputGestureText="Alt+O" />
                <MenuItem Header="E_xit" Command="ApplicationCommands.Close" />
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Header="_About" Command="loc:ResourceBlenderCommands.ShowAbout" />
            </MenuItem>
        </Menu>
        <ToolBar x:Name="tlbMain" DockPanel.Dock="Top" VerticalAlignment="Top" HorizontalAlignment="Stretch" IsHitTestVisible="True" HorizontalContentAlignment="Left">
            <loc:ToolBarButton x:Name="btnApplications" Command="loc:ResourceBlenderCommands.ViewApplications" Text="Applications" Image="images/applications_32.png" ToolTip="Manage applications" />
            <loc:ToolBarButton x:Name="btnResources" Command="loc:ResourceBlenderCommands.ViewResourcesPrompt" Text="Resources" Image="images/resources_32.png" ToolTip="View and edit resources" />
            <loc:ToolBarButton x:Name="btnGenerate" Command="loc:ResourceBlenderCommands.GenerateResources" Text="Generate" Image="images/factory_32.png" ToolTip="Create output files from resources" />
            <Separator  />
            <loc:ToolBarButton x:Name="btnOptions" Command="loc:ResourceBlenderCommands.ShowOptions" Text="Options" Image="images/settings_32.png" />
        </ToolBar>
        <StatusBar DockPanel.Dock="Bottom" Height="24">
            <StatusBarItem x:Name="lblStatus" Visibility="Hidden">Loading Summary</StatusBarItem>
            <ProgressBar x:Name="prgStatus" IsIndeterminate="True" Visibility="Hidden" />
        </StatusBar>
        <!--ScrollViewer x:Name="scrSummary" DockPanel.Dock="Top" VerticalScrollBarVisibility="Auto"-->
        <TabControl DockPanel.Dock="Top"  Background="Transparent" BorderThickness="0">
            <TabItem Height="0">
                <ListBox x:Name="lstApps" Style="{StaticResource InvisibleListBox}" ItemTemplate="{StaticResource SummaryApplication}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel IsItemsHost="True" CanHorizontallyScroll="False" CanVerticallyScroll="True" />
                            <!--StackPanel CanVerticallyScroll="True" CanHorizontallyScroll="False" /-->
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                </ListBox>
            </TabItem>
            <TabItem Height="0">
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">No applications have been added, click Applications to add one.</TextBlock>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
